3.1.2 \(\int \frac {A+B \sin (x)}{1+\cos (x)} \, dx\) [2]

Optimal. Leaf size=19 \[ -B \log (1+\cos (x))+\frac {A \sin (x)}{1+\cos (x)} \]

[Out]

-B*ln(cos(x)+1)+A*sin(x)/(cos(x)+1)

________________________________________________________________________________________

Rubi [A]
time = 0.05, antiderivative size = 19, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 4, integrand size = 13, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.308, Rules used = {4486, 2727, 2746, 31} \begin {gather*} \frac {A \sin (x)}{\cos (x)+1}-B \log (\cos (x)+1) \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(A + B*Sin[x])/(1 + Cos[x]),x]

[Out]

-(B*Log[1 + Cos[x]]) + (A*Sin[x])/(1 + Cos[x])

Rule 31

Int[((a_) + (b_.)*(x_))^(-1), x_Symbol] :> Simp[Log[RemoveContent[a + b*x, x]]/b, x] /; FreeQ[{a, b}, x]

Rule 2727

Int[((a_) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> Simp[-Cos[c + d*x]/(d*(b + a*Sin[c + d*x])), x]
/; FreeQ[{a, b, c, d}, x] && EqQ[a^2 - b^2, 0]

Rule 2746

Int[cos[(e_.) + (f_.)*(x_)]^(p_.)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.), x_Symbol] :> Dist[1/(b^p*f), S
ubst[Int[(a + x)^(m + (p - 1)/2)*(a - x)^((p - 1)/2), x], x, b*Sin[e + f*x]], x] /; FreeQ[{a, b, e, f, m}, x]
&& IntegerQ[(p - 1)/2] && EqQ[a^2 - b^2, 0] && (GeQ[p, -1] ||  !IntegerQ[m + 1/2])

Rule 4486

Int[u_, x_Symbol] :> With[{v = ExpandTrig[u, x]}, Int[v, x] /; SumQ[v]] /;  !InertTrigFreeQ[u]

Rubi steps

\begin {align*} \int \frac {A+B \sin (x)}{1+\cos (x)} \, dx &=\int \left (\frac {A}{1+\cos (x)}+\frac {B \sin (x)}{1+\cos (x)}\right ) \, dx\\ &=A \int \frac {1}{1+\cos (x)} \, dx+B \int \frac {\sin (x)}{1+\cos (x)} \, dx\\ &=\frac {A \sin (x)}{1+\cos (x)}-B \text {Subst}\left (\int \frac {1}{1+x} \, dx,x,\cos (x)\right )\\ &=-B \log (1+\cos (x))+\frac {A \sin (x)}{1+\cos (x)}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.04, size = 19, normalized size = 1.00 \begin {gather*} -2 B \log \left (\cos \left (\frac {x}{2}\right )\right )+A \tan \left (\frac {x}{2}\right ) \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[(A + B*Sin[x])/(1 + Cos[x]),x]

[Out]

-2*B*Log[Cos[x/2]] + A*Tan[x/2]

________________________________________________________________________________________

Maple [A]
time = 0.04, size = 19, normalized size = 1.00

method result size
default \(A \tan \left (\frac {x}{2}\right )+B \ln \left (1+\tan ^{2}\left (\frac {x}{2}\right )\right )\) \(19\)
norman \(A \tan \left (\frac {x}{2}\right )+B \ln \left (1+\tan ^{2}\left (\frac {x}{2}\right )\right )\) \(19\)
risch \(i B x +\frac {2 i A}{{\mathrm e}^{i x}+1}-2 B \ln \left ({\mathrm e}^{i x}+1\right )\) \(31\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((A+B*sin(x))/(cos(x)+1),x,method=_RETURNVERBOSE)

[Out]

A*tan(1/2*x)+B*ln(1+tan(1/2*x)^2)

________________________________________________________________________________________

Maxima [A]
time = 0.27, size = 19, normalized size = 1.00 \begin {gather*} -B \log \left (\cos \left (x\right ) + 1\right ) + \frac {A \sin \left (x\right )}{\cos \left (x\right ) + 1} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((A+B*sin(x))/(1+cos(x)),x, algorithm="maxima")

[Out]

-B*log(cos(x) + 1) + A*sin(x)/(cos(x) + 1)

________________________________________________________________________________________

Fricas [A]
time = 0.43, size = 28, normalized size = 1.47 \begin {gather*} -\frac {{\left (B \cos \left (x\right ) + B\right )} \log \left (\frac {1}{2} \, \cos \left (x\right ) + \frac {1}{2}\right ) - A \sin \left (x\right )}{\cos \left (x\right ) + 1} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((A+B*sin(x))/(1+cos(x)),x, algorithm="fricas")

[Out]

-((B*cos(x) + B)*log(1/2*cos(x) + 1/2) - A*sin(x))/(cos(x) + 1)

________________________________________________________________________________________

Sympy [A]
time = 0.12, size = 17, normalized size = 0.89 \begin {gather*} A \tan {\left (\frac {x}{2} \right )} + B \log {\left (\tan ^{2}{\left (\frac {x}{2} \right )} + 1 \right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((A+B*sin(x))/(1+cos(x)),x)

[Out]

A*tan(x/2) + B*log(tan(x/2)**2 + 1)

________________________________________________________________________________________

Giac [A]
time = 0.49, size = 18, normalized size = 0.95 \begin {gather*} B \log \left (\tan \left (\frac {1}{2} \, x\right )^{2} + 1\right ) + A \tan \left (\frac {1}{2} \, x\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((A+B*sin(x))/(1+cos(x)),x, algorithm="giac")

[Out]

B*log(tan(1/2*x)^2 + 1) + A*tan(1/2*x)

________________________________________________________________________________________

Mupad [B]
time = 2.18, size = 18, normalized size = 0.95 \begin {gather*} B\,\ln \left ({\mathrm {tan}\left (\frac {x}{2}\right )}^2+1\right )+A\,\mathrm {tan}\left (\frac {x}{2}\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((A + B*sin(x))/(cos(x) + 1),x)

[Out]

B*log(tan(x/2)^2 + 1) + A*tan(x/2)

________________________________________________________________________________________